
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>2、RocketMQ_快速入门指南 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>2、RocketMQ_快速入门指南 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">部署</div>
          <div class="card-question">在单机部署RocketMQ时，有哪些前置条件需要满足？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">部署</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">单机部署RocketMQ需要满足三个前置条件：1. JDK 1.8+；2. Maven 3.2.x+（如果需要从源码编译）；3. 4GB以上的可用内存。</div>
          </div>
          <div class="card-source">来源: 1. 环境搭建与部署 -> 单机部署步骤与配置说明 -> 前置条件</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">配置</div>
          <div class="card-question">在RocketMQ的Broker配置文件中，`brokerId`参数的作用是什么？它的不同取值代表什么含义？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">配置</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`brokerId`用于标识Broker的ID。当`brokerId`为0时，表示该Broker是Master节点；当`brokerId`大于0时，表示该Broker是Slave节点。</div>
          </div>
          <div class="card-source">来源: 1. 环境搭建与部署 -> 单机部署步骤与配置说明 -> 配置文件说明</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">RocketMQ的“多Master多Slave模式（同步双写）”集群架构有哪些优缺点？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">优点是消息不会丢失，可靠性最高。缺点是性能相对较低，大约会下降10%左右。</div>
          </div>
          <div class="card-source">来源: 1. 环境搭建与部署 -> 集群部署架构与实施指南 -> 多Master多Slave模式（同步双写）</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">排错</div>
          <div class="card-question">当RocketMQ服务启动失败，日志中出现`BindException`时，通常是什么原因导致的？应如何解决？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">排错</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">这通常是由于端口冲突导致的。解决方案是使用`netstat -anp | grep <port>`命令检查端口占用情况，然后修改配置文件中的端口设置以避免冲突。</div>
          </div>
          <div class="card-source">来源: 1. 环境搭建与部署 -> 常见部署问题排查 -> 2. 端口冲突</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">命令</div>
          <div class="card-question">如何使用`mqadmin`命令行工具查看指定消费者组的消费进度和积压情况？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">命令</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以使用命令 `sh bin/mqadmin consumerProgress -n <namesrv_addr> -g <group_name>` 来查看指定消费者组的消费情况。</div>
          </div>
          <div class="card-source">来源: 2. 基本命令行操作 -> 集群状态查询命令 -> 消费者管理</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">集成</div>
          <div class="card-question">在Spring Boot项目中集成RocketMQ时，需要在`pom.xml`中添加哪个核心依赖？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">集成</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要添加 `rocketmq-spring-boot-starter` 依赖。其groupId为 `org.apache.rocketmq`，artifactId为 `rocketmq-spring-boot-starter`。</div>
          </div>
          <div class="card-source">来源: SpringBoot整合RocketMQ -> 1. 环境准备 -> 1.1 依赖配置</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在Spring Boot中，如何使用`RocketMQTemplate`发送一个延迟消息？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以通过调用`RocketMQTemplate`的`syncSend`方法，并传入四个参数来实现：topic、消息体(使用`MessageBuilder`构建)、发送超时时间和延迟级别（delayLevel），其中延迟级别是一个1到18的整数。</div>
          </div>
          <div class="card-source">来源: SpringBoot整合RocketMQ -> 2. 消息生产者实现 -> 2.2 生产者服务</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">集成</div>
          <div class="card-question">在Spring Boot中实现一个RocketMQ消费者，主要需要使用哪个注解，并实现哪个接口？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">集成</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要使用 `@RocketMQMessageListener` 注解来声明一个消费者服务，并实现 `RocketMQListener<T>` 接口来定义消息处理逻辑。</div>
          </div>
          <div class="card-source">来源: SpringBoot整合RocketMQ -> 3. 消息消费者实现 -> 3.1 普通消费者</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">RocketMQ的事务消息监听器（`RocketMQTransactionListener`）需要实现哪两个核心方法，它们各自的作用是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">需要实现两个核心方法：1. `executeLocalTransaction`：用于执行本地事务。2. `checkLocalTransaction`：用于在Broker发起回查请求时，检查本地事务的最终状态（提交或回滚）。</div>
          </div>
          <div class="card-source">来源: SpringBoot整合RocketMQ -> 3. 消息消费者实现 -> 3.2 事务消息监听器</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
